import axios from 'axios';
import type { TableData } from '@arco-design/web-vue/es/table/interface';

export interface ContentDataRecord {
  x: string;
  y: number;
}

export function queryContentData() {
  return axios.get<ContentDataRecord[]>('/api/content-data');
}

export interface PopularRecord {
  key: number;
  clickNumber: string;
  title: string;
  increases: number;
}

export function queryPopularList(params: { type: string }) {
  return axios.get<TableData[]>('/api/popular/list', { params });
}

// 上传文件附件
export function upload(data: any) {
  return axios.post('/global/upload', data);
}

// 获取全局用户信息
export function getGlobalUserInfo(data: any) {
  return axios.get('/global/user', {
    params: data,
  });
}

// // 惠企政通
// 慢点
// export function getai(data: any) {
//   return axios.post('/global/ai', data);
// }

// // 惠企政通
// 快点
export function getai(data: any) {
  return axios.post('/global/ai/search', data);
}
